<template>
  <div class="card-container">
    <div class="card-layout">
      <div class="card-top-view hor-layout-center">
        <div class="card-title">{{ chartTitle }}</div>
        <div class="card-right-button" :class="{ 'card-right-button_sel': citySelect }" @click="cityButtonClick">
          广西城市
        </div>
      </div>
      <!-- 排名图表 -->
      <div class="card-content">
        <!-- 排名图表 -->
        <div class="card-item" v-for="(sourceItem, sourceIdx) in sourceList">
          <div class="grade-title hor-layout-center">
            <!-- 图标 -->
            <div
              class="grade-image"
              :style="{ backgroundImage: 'url(' + sourceConfig.images[sourceIdx > 2 ? 3 : sourceIdx] + ')' }"
            >
              <span class="grade-image-num hor-layout-center-all" :style="{ display: sourceIdx < 3 ? 'none' : '' }">
                {{ sourceIdx + 1 }}
              </span>
            </div>
            <!-- 名称 -->
            <div
              class="grade-name van-ellipsis"
              :style="{ marginLeft: sourceIdx > 3 ? '2px' : '' }"
              @click="clickMsg(sourceItem.name)"
            >
              {{ sourceItem.name }}
            </div>
          </div>
          <div class="grade-progress-view">
            <span
              class="progress__portion"
              :style="[{ width: sourceItem.percent }, { background: sourceConfig.colors[sourceIdx] }]"
            ></span>
          </div>
          <div class="grade-value">
            {{ sourceItem.flow }}
            <span class="grade-unit">人次</span>
          </div>
        </div>
      </div>
      <div style="height: 25px;"></div>
    </div>
  </div>
</template>

<script src="./indexJs.js"></script>

<style scoped>
.card-container {
  width: 100%;
  margin-top: 15px;
}

.card-layout {
  width: 345px;
  margin: auto;
  background: rgba(255, 255, 255, 1);
  border-radius: 6px;
}

.card-top-view {
  padding: 17px;
  padding-bottom: 0px;
  justify-content: space-between;
}

.card-title {
  font-size: 21px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(64, 65, 68, 1);
  line-height: 29px;
}

.card-right-button {
  height: 19px;
  border-radius: 15px;
  border: 1px solid rgba(69, 117, 238, 1);
  padding: 2px 7px;
  /*  字体样式*/
  line-height: 19px;
  font-size: 13px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(69, 117, 238, 1);
}

.card-right-button_sel {
  background: rgba(69, 117, 238, 1);
  color: white;
}

.card-content {
  height: calc(27 * 10px);
  margin-left: 25px;
  margin-right: 14px;
  margin-top: 10px;
  overflow: scroll;
}

.card-item {
  margin: 7px 0px;
  box-sizing: border-box;
}

.grade-name {
  width: 50px;
  margin-left: 3px;
  font-size: 15px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(85, 85, 85, 1);
  line-height: 21px;
}

.grade-title {
  width: 80px;
  justify-content: flex-start;
}

.grade-image {
  width: 20px;
  height: 20px;
  display: flex;
  background-size: 100% 100%;
  /*  字体样式*/
  font-size: 10px;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500;
  color: #969696;
  line-height: 14px;
}

.grade-image-num {
  flex: 1;
  margin-top: 4px;
}

.grade-progress-view {
  /* flex: 1; */
  height: 5px;
  position: relative;
  margin-left: 10px;
  margin-right: 7px;
  background: #ebedf0;
  border-radius: 3px;
  width: 110px;
}

.progress__portion {
  position: absolute;
  left: 0;
  height: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(56, 88, 230, 1) 0%, rgba(0, 189, 255, 1) 100%, rgba(0, 192, 255, 1) 100%);
  border-radius: inherit;
}

.grade-value {
  width: 80px;
  text-align: right;
  font-size: 14px;
  font-family: Helvetica;
  color: rgba(85, 85, 85, 1);
  line-height: 17px;
}

.grade-unit {
  font-size: 13px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(85, 85, 85, 1);
  line-height: 18px;
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>
